﻿/*
 * Created by SharpDevelop.
 * User: Alice
 * Date: 18.03.2012
 * Time: 18:12
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections;

namespace monoServer
{
	/// <summary>
	/// Description of Error.
	/// </summary>
	public class Error
	{
		public int code;
		public String text;
		private Hashtable list;	
		
		public Error(int c, String t)
		{
			this.code = c;
			this.text = t;
		}
		
		public Error(String t)
		{
			this.code = 0;
			this.text = t;
		}
		
		public Error(int c)
		{
			this.code = c;
		}
		
		public Error()
		{
			this.list = new Hashtable();
			this.list.Add(1000, "Invalid numbers of Parameters @ LOGIN");
			this.list.Add(1001, "No Username given");
			this.list.Add(1002, "No Password given");
			this.list.Add(1003, "Wrong Password");
			this.list.Add(1004, "Username doesn't exists");
			this.list.Add(1005, "User is banned");
		}
		
		public String toString()
		{
			return "#" + this.code.ToString() + " - " + this.text;
		}
		
		public String toString(String separator)
		{
			return "#" + this.code.ToString()+separator+this.text;
		}
		
		public Error merge(Error e)
		{
			e.text = (String)this.list[e.code];
			return e;
		}
	}
}
